import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Moneda here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Moneda extends Bono
{
    /**
     * Act - do whatever the Moneda wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    private GreenfootImage [] moneda;
    private int delay =0;
    private int sprite=0;
    public Moneda()
    {
        super(200);
        moneda=new GreenfootImage[10];
         for(int i=1; i<=moneda.length; i++)
        {
            moneda[i-1] = new GreenfootImage("Moneda"+i+".png");
            moneda[i-1].scale(35,35);
        }
       
        setImage(moneda[sprite]);
    }
    public void act() 
    {
        animacion();
        super.act();
        
        // Add your action cod;e here.
    }    
     public void animacion()
    {
       
        if(delay==4)
        {
            delay=0;
            sprite++;
            if(sprite==moneda.length-1)
            sprite=0;
            
            setImage(moneda[sprite]);
        }
        else
        delay++;
    }
    
   
   
}
